#include <myhead.h>
#include "userinfo.h"
typedef struct sockaddr_in addr_in_t;
typedef struct sockaddr addr_t;      
typedef struct sockaddr_un addr_un_t;

int main(int argc, const char *argv[])
{
	link_t* L=link_create();
	userinfo_t u={0};
	strcpy(u.username, "zhang");
	strcpy(u.passwd, "111");
	link_insertHead(L, u);
	//file_appendUser(u);//追加到文件里

	strcpy(u.username, "lili");
	strcpy(u.passwd, "222");
	link_insertHead(L, u);
	//file_appendUser(u);//追加到文件里
	
	node_t* n=link_findByUsername(L,"zhang");
	printf("[%s][%s]\n",n->data.username,n->data.passwd);
	n=link_findByUsername(L,"lili");
	printf("[%s][%s]\n",n->data.username,n->data.passwd);
	n=link_findByUsername(L,"1111");
	n==NULL?printf("n == NULL!\n"):printf("FAILED! n is not NULL\n");

	link_destroy(L);

	printf("***********************\n");
	L=file_load();
	printf("asdfasdfasdf\n");
	n=link_findByUsername(L,"zhang");
	printf("[%s][%s]\n",n->data.username,n->data.passwd);
	n=link_findByUsername(L,"lili");
	printf("[%s][%s]\n",n->data.username,n->data.passwd);
	n=link_findByUsername(L,"1111");
	n==NULL?printf("n == NULL!\n"):printf("FAILED! n is not NULL\n");

	return 0;
}
